package cn.iocoder.yudao.module.contract.controller.admin.exportContract.vo;

import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import cn.iocoder.yudao.module.contract.utils.StringUtils;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

@Schema(description = "管理后台 - 出口合同分页 Request VO")
@Data
@ExcelIgnoreUnannotated
public class ExportContractExportVO {

    @Schema(description = "合同状态", example = "1")
    @ExcelProperty(value="合同状态", converter = DictConvert.class)
    @DictFormat("order_contract_status") // TODO 代码优化：建议设置到对应的 DictTypeConstants 枚举类中
    private String status;

    @Schema(description = "合同类型", example = "1")
    @ExcelProperty("合同类型")
    private String type;

    @Schema(description = "合同日期")
    @ExcelProperty("合同日期")
    private String audat;

    @Schema(description = "合同号码")
    @ExcelProperty("合同号码")
    private String bstnk;

    @Schema(description = "组织编码")
    @ExcelProperty("组织编码")
    private String vkorg;

    @Schema(description = "销售方编码")
    @ExcelProperty("销售方编码")
    private String bukrs;

    @Schema(description = "销售方名称")
    @ExcelProperty("销售方名称")
    private String butxt;

    @Schema(description = "售达方编码")
    @ExcelProperty("售达方编码")
    private String kunnr;

    @Schema(description = "售达方名称", example = "张三")
    @ExcelProperty("售达方名称")
    private String kname;

    @Schema(description = "付款条件", example = "张三")
    @ExcelProperty("付款条件")
    private String paymentName;

    @Schema(description = "装运期限")
    @ExcelProperty("装运期限")
    private String vdatu;

    @Schema(description = "国际贸易条件")
    @ExcelProperty("国际贸易条件")
    private String inco1;

    @Schema(description = "国际贸易条件2")
    @ExcelProperty("国际贸易条件2")
    private String inco2;

    @Schema(description = "包装方式", example = "赵六")
    @ExcelProperty("包装方式")
    private String packingName;

    @Schema(description = "收款银行", example = "李四")
    @ExcelProperty("收款银行")
    private String bankName;

    @Schema(description = "经销商名称")
    @ExcelProperty("经销商名称")
    private String zzlifnrt;

    @Schema(description = "总金额")
    @ExcelProperty("总金额")
    private String totalMoney;

    @Schema(description = "下载次数", example = "12708")
    @ExcelProperty("下载次数")
    private Integer downloadCount;

    @Schema(description = "打印次数", example = "13810")
    @ExcelProperty("打印次数")
    private Integer printCount;


    @Schema(description = "原件是否上传")
    @ExcelProperty("原件是否上传")
    private String fileIds;


    @Schema(description = "释放推送状态")
    @ExcelProperty(value = "释放推送状态", converter = DictConvert.class)
    @DictFormat("order_contract_push_release") // TODO 代码优化：建议设置到对应的 DictTypeConstants 枚举类中
    private String isPushRelease;

    @Schema(description = "异常原因")
    @ExcelProperty("异常原因")
    private String abnormalCause;

    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("创建时间")
    @ColumnWidth(20)
    private LocalDateTime createTime;


    public String getFileIds() {
        if(StringUtils.isBlank(fileIds)){
            return "否";
        }else{
            return "是";
        }
    }


    public String getType(){
        if("1".equals(type)){
            return "出口订单合同";
        }else if("2".equals(type)){
            return "佣金合同";
        }else{
            return "";
        }
    }
}